/* 367. 有效的完全平方数 */
/**
 * @param {number} num
 * @return {boolean}
 */
var isPerfectSquare = function (num) {
	let left = 0,
		right = num
	while (left <= right) {
		const mid = left + ((right - left) >> 1)
		const cur = mid ** 2
		if (cur === num) {
			return true
		} else if (cur < num) {
			left = mid + 1
		} else {
			right = mid - 1
		}
	}
	return false
}
const res = isPerfectSquare(9)
console.log('isPerfectSquare :>>', res)
